<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    // 1 1 2 3 5 8 13 21.......
    //推导公式：fib(m) = fib(m-1) + fib(m-2)
    //后一个数=前两个数相加之和
    window.onload =function(){
        let n =prompt("请输入想要的第n个斐波那契数列的数")
        function feibonaqi(n){
            if(n==1|| n==2){
                return 1
            }else{
                return feibonaqi(n-1)+feibonaqi(n-2)
            }
        }
        feibonaqi(n)
        alert (feibonaqi(n))
    }
</script>